<div class="bjui-pageContent">
    <table class="table table-bordered" id="datagrid-product-list" data-toggle="datagrid" data-options="{
        height: '100%',
        gridTitle : '产品列表',
        showToolbar: true,
        toolbarItem: 'add',
        editMode: 'dialog',
        local: 'remote',
        dataUrl: '/admin/category/fields-list',
        editUrl: '/admin/category/fields-save?category_id={{$categoryId}}',
        delUrl: '/admin/category/fields-del',
        postData:{'category_id':{{$categoryId}} },
        delPK: 'id',
        linenumberAll: true,
        sortAll: false,
        contextMenuH: true,
        contextMenuB: true,
        inlineEditMult: false,
        paging: {showPagenum:10, selectPageSize:'20,50,100', pageCurrent:1, pageSize:20},
        showEditbtnscol: false,
        customEditbtns: {width:200,position:'replace'},
        fullGrid: true,
        fieldSortable: false,
        filterThead: false,
        columnMenu: false,
    }">
        <thead>
        <tr>
            <th data-options="{name:'field_name',align:'center',width:100}">字段名称</th>
            <!--<th data-options="{name:'type',type:'select', items:[{1:'标准属性'}, {2:'非标属性'}],align:'center',width:100}">类型</th>-->
            <th data-options="{name:'sort_id',align:'center',width:30}">排序</th>
            <th data-options="{name:'placeholder',align:'center',width:100}">提示文字</th>
            <!--<th data-options="{name:'field_type', type:'select', items:fields_type, align:'center',width:100}">字段类型</th>-->
            <th data-options="{name:'is_must', type:'select', items:is_must, align:'center',width:100}">是否必填</th>
            <!--<th data-options="{name:'field_value',align:'center',width:80}">标准值</th>
            <th data-options="{name:'min_value',align:'center',width:80}">最小值</th>
            <th data-options="{name:'max_value',align:'center',width:80}">最大值</th>-->
            <th data-options="{name:'field_unit',align:'center',width:80}">单位</th>
            <th data-options="{render:'datagrid_tree_operation'}">操作</th>
        </tr>
        </thead>
    </table>
</div>
<script>
    function fields_type(){
        return [{!! $fieldsType !!}]
    }

    function is_must(){
        return [{'0':'否','1':'是'}]
    }

    // 操作列
    function datagrid_tree_operation(value, data) {
        var html = '<button type="button" class="btn-green" data-toggle="edit.datagrid.tr">编辑</button>'
//                + '<button type="button" class="btn-red" data-toggle="del.datagrid.tr">设置</button>'
                + '<button type="button" class="btn-red" data-toggle="del.datagrid.tr">删除</button>'

        return html
    }
</script>